<% layout('/layouts/default.html', {title: '教师管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-user"></i>
				
			</div>
			
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${empUser}" action="${ctx}/sys/empUser/actionData" method="post" class="form-inline "
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<#form:hidden name="ctrlPermi" value="2"/>
				
				
				<div class="form-group">
					<label class="control-label">${text('统计筛选')}：</label>
					<div class="control-inline">
						<select name="action" class="form-control width-90">
						
							<option value="">请选择</option>
							<option value="m" <%if(action=="m"){%> selected <%}%> >已确认人数</option>
							<option value="n" <%if(action=="n"){%> selected <%}%> >未登录人数</option>
							<option value="x" <%if(action=="x"){%> selected <%}%> >已修改人数</option>
							<option value="y" <%if(action=="y"){%> selected <%}%> > 未修改人数</option>
						</select>
						<input type="hidden" name="office.officeCode" value="${officeCode}"/>
					</div>
				</div>
				
				
			
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					
					
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
					<a href="javascript:" id="btnExport" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-export"></i> 导出</a>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("登录账号")}', name:'loginCode', index:'a.login_code', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){
			if(val.length==18){
				var val=val.replace(/^(.{4})(?:\d+)(.{4})$/,"$1******$2");
			}
			return '<a href="${ctx}/sys/empUser/form?userCode='+row.userCode+'&op=edit" class="btnList" data-title="${text("编辑教师")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("教师姓名")}', name:'userName', index:'a.user_name', width:200, align:"center"},
		{header:'${text("供职院校")}', name:'employee.office.officeName', index:'o.office_name', width:200, align:"center"},
		{header:'${text("毕业院校")}', name:'employee.company.companyName', index:'c.company_name', width:200, align:"center"},
		{header:'${text("登录时间")}', name:'lastLoginDate', index:'a.last_login_date', width:200, align:"center"},
		{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:200, align:"center"},
		{header:'${text("当前状态")}', name:'employee.state', index:'a.state', width:140, align:"center", formatter: function(val, obj, row, act){
			if(val=='01'){
				return '<p class="text-muted">'+js.getDictLabel(${@DictUtils.getDictListJson('teacher_state')}, val, '未知', true) +'</p>';
			}else if (val=='02'){
				return '<p class="text-danger">'+js.getDictLabel(${@DictUtils.getDictListJson('teacher_state')}, val, '未知', true) +'</p>';
			}else if (val=='99'){
				return '<p class="text-success">'+js.getDictLabel(${@DictUtils.getDictListJson('teacher_state')}, val, '未知', true) +'</p>';
			}else{
				return '<p class="text-info">'+js.getDictLabel(${@DictUtils.getDictListJson('teacher_state')}, val, '未知', true) +'</p>';
			}
			
		}},
		{header:'${text("用户状态")}', name:'status', index:'a.status', width:140, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_status')}, val, '未知', true);
		}},
		
		{header:'${text("操作记录")}', name:'actions', width:260, sortable:false,align:"center",  title:false, formatter: function(val, obj, row, act){
			if(row.employee.op!=null && row.employee.op!=''){
				var msg = row.employee.op.replace(/\n|\r/g,"");
				<%if(action=="x"){%> return '<a href="javascript:" onclick="layer.alert(\''+msg+'\')" >查看修改轨迹</a>'; <%}%>
			}
			
			return "";
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
$('#btnExport').click(function(){
	js.ajaxSubmitForm($('#searchForm'), {
		url:'${ctx}/sys/empUser/exportAction',
		downloadFile:true
	});
});</script>